﻿using System;
using System.Configuration;
using System.Windows;
using System.Windows.Controls;

namespace FrontDisplay
{
    public abstract class PluginBase : IPlugin
    {
        public event Action<IPlugin> Activated;
        public event Action<IPlugin> Deactivated;

        private bool _isActive;

        public bool IsActive
        {
            get { return _isActive; }
            protected set
            {
                if (_isActive == value) return;
                _isActive = value;
                if (value)
                {
                    Activated.Fire(this);
                }
                else
                {
                    Deactivated.Fire(this);
                }
            }
        }

        public virtual void ThemeChanged() { }
        public virtual UIElement MenuButton { get { return null; } }

        public abstract string Title { get; }
        public abstract void Start();
        public abstract void Stop();

        public abstract Control PageControl { get; }
        public abstract UIElement TopControl { get; }
        public abstract UIElement BottomControl { get; }
        public abstract UIElement ParametersControl { get; }

        public virtual ApplicationSettingsBase Config { get { return null; } }

        public virtual void SaveConfig(UIElement element) { }
    }
}
